﻿using Furion.DynamicApiController;
using HOPU.OnlineSchool.Application.Users.Dtos;
using HOPU.OnlineSchool.Application.Users.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HOPU.OnlineSchool.Application.Users
{
    /// <summary>
    /// 用户服务接口
    /// </summary>
    public class UserAppService : IDynamicApiController
    {
        private readonly IUserServices _userServices;

        public UserAppService(IUserServices userServices)
        {
            _userServices = userServices;
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="login"></param>
        /// <returns></returns>
        public Task<LoginOut> PostLogin(LoginInfo login)
        {
            return _userServices.LoginAsync(login);
        }

        /// <summary>
        /// 获取用户信息（临时处理，后期替换）
        /// </summary>
        /// <returns></returns>
        public UserInfoDto GetInfo()
        {
            var dto = new UserInfoDto()
            {
                Avatar = "",
                Name = "孙悟空",
                Roles = new string[] { "Admin" }

            };

            return dto;
        }
    }
}
